﻿#ifndef __OPERATION__
#define __OPERATION__

#include <iostream>
#include <string>
#include <sstream>
namespace hw
{
	enum class Op
	{
		ADD = 1,
		DEL = 2, //删除虚拟机操作
	};
	struct Operation
	{
		//构造函数
		Operation(Op &mode, const std::string &vmid, const std::string &vm_type_id) : mode(mode), vmid(vmid), vm_type_id(vm_type_id){};
		Operation(Op &mode, const std::string &vm_type_id) : mode(mode), vm_type_id(vm_type_id) { vmid = -1; };
		Operation() = default;
		std::string repr()
		{
			std::ostringstream buffer;
			if (mode == Op::ADD)
				buffer << "Operation("
					   << "add" << ',' << vmid << ',' << vm_type_id << ')';
			else
			{
				buffer << "Operation("
					   << "del" << ',' << vm_type_id << ')';
			}
			std::string str = buffer.str();
			return str;
		}

		Op mode;
		std::string vmid;
		std::string vm_type_id;
	};
}; // namespace hw
#endif
